package com.cyy.prototype_pattern.deep_clone;

/**
 * 虹猫个体类 重写了clone方法，在clone方法中调用了hong.clone()方法克隆了一个虹猫灵魂
 */
public class Qian implements Cloneable{
    //身体属性
   private String shou;
   private String jiao;
   private String yan;
   //灵魂属性
   private Hong hong;

    public Qian() {
    }

    public Qian(String shou, String jiao, String yan, Hong hong) {
        this.shou = shou;
        this.jiao = jiao;
        this.yan = yan;
        this.hong = hong;
    }

    //重写clone()方法
    public Qian clone() throws CloneNotSupportedException {
        Qian qian = (Qian) super.clone();
        hong = hong.clone();
        return qian;
    }

    public String getShou() {
        return shou;
    }

    public void setShou(String shou) {
        this.shou = shou;
    }

    public String getJiao() {
        return jiao;
    }

    public void setJiao(String jiao) {
        this.jiao = jiao;
    }

    public String getYan() {
        return yan;
    }

    public void setYan(String yan) {
        this.yan = yan;
    }

    public Hong getHong() {
        return hong;
    }

    public void setHong(Hong hong) {
        this.hong = hong;
    }
}
